﻿using System;
using System.Data;
using Ue.Framework.Data;
using Ue.Infrastructure.EntityFactoryFramework;
using Ue.Qcdz.Domain.Roles;

namespace Ue.Qcdz.Repositories.Roles
{
    internal class RoleFactory : IEntityFactory<Role>
    {
        internal class FieldNames : FieldNamesBase
        {
            public const string Name = "Name";
            public const string ResourceId = "ResourceId";
            public class PermissionFieldNames
            {
                public const string RoleId = "RoleId";
                public const string PermissionsId = "PermissionId";
                
            }
        }

        #region IEntityFactory
        public Role BuildEntity(IDataReader reader)
        {
            return new RoleProxy(
                reader.Get<string>(FieldNames.Name),
                reader.Get<Guid>(FieldNames.EntityKey)
                
                );
        } 
        #endregion
    }
}
